from taskiq import TaskiqScheduler
from taskiq_redis import redis_broker

# 初始化 Redis Broker
broker = redis_broker("redis://1921.168.77.101:6379")

# 可选：配置定时任务
scheduler = TaskiqScheduler(
    broker=broker,
    tasks_source="tasks_module"  # 指定任务模块
)


from taskiq import TaskiqDepends

@broker.task
async def add_numbers(a: int, b: int) -> int:
    print(f"Calculating {a} + {b}")
    return a + b

@broker.task
async def process_data(data: str) -> str:
    import time
    time.sleep(2)  # 模拟耗时操作
    return f"Processed: {data.upper()}"

